3.4.2 \(\int \sqrt {a+b \tan ^2(e+f x)} \, dx\) [302]

Optimal. Leaf size=85 \[ \frac {\sqrt {a-b} \text {ArcTan}\left (\frac {\sqrt {a-b} \tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f}+\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f} \]

[Out]

arctan((a-b)^(1/2)*tan(f*x+e)/(a+b*tan(f*x+e)^2)^(1/2))*(a-b)^(1/2)/f+arctanh(b^(1/2)*tan(f*x+e)/(a+b*tan(f*x+
e)^2)^(1/2))*b^(1/2)/f

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 85, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.375, Rules used = {3742, 399, 223, 212, 385, 209} \begin {gather*} \frac {\sqrt {a-b} \text {ArcTan}\left (\frac {\sqrt {a-b} \tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f}+\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sqrt[a + b*Tan[e + f*x]^2],x]

[Out]

(Sqrt[a - b]*ArcTan[(Sqrt[a - b]*Tan[e + f*x])/Sqrt[a + b*Tan[e + f*x]^2]])/f + (Sqrt[b]*ArcTanh[(Sqrt[b]*Tan[
e + f*x])/Sqrt[a + b*Tan[e + f*x]^2]])/f

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 223

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a,
b}, x] &&  !GtQ[a, 0]

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Subst[Int[1/(c - (b*c - a*d)*x^n), x]
, x, x/(a + b*x^n)^(1/n)] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && EqQ[n*p + 1, 0] && IntegerQ[n]

Rule 399

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Dist[b/d, Int[(a + b*x^n)^(p - 1), x]
, x] - Dist[(b*c - a*d)/d, Int[(a + b*x^n)^(p - 1)/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, p}, x] && NeQ[b*c
 - a*d, 0] && EqQ[n*(p - 1) + 1, 0] && IntegerQ[n]

Rule 3742

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[c*(ff/f), Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \sqrt {a+b \tan ^2(e+f x)} \, dx &=\frac {\text {Subst}\left (\int \frac {\sqrt {a+b x^2}}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a-b) \text {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \sqrt {a+b x^2}} \, dx,x,\tan (e+f x)\right )}{f}+\frac {b \text {Subst}\left (\int \frac {1}{\sqrt {a+b x^2}} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a-b) \text {Subst}\left (\int \frac {1}{1-(-a+b) x^2} \, dx,x,\frac {\tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f}+\frac {b \text {Subst}\left (\int \frac {1}{1-b x^2} \, dx,x,\frac {\tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f}\\ &=\frac {\sqrt {a-b} \tan ^{-1}\left (\frac {\sqrt {a-b} \tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f}+\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b \tan ^2(e+f x)}}\right )}{f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.24, size = 108, normalized size = 1.27 \begin {gather*} -\frac {\sqrt {a-b} \text {ArcTan}\left (\frac {\sqrt {b}+\sqrt {b} \tan ^2(e+f x)-\tan (e+f x) \sqrt {a+b \tan ^2(e+f x)}}{\sqrt {a-b}}\right )+\sqrt {b} \log \left (-\sqrt {b} \tan (e+f x)+\sqrt {a+b \tan ^2(e+f x)}\right )}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sqrt[a + b*Tan[e + f*x]^2],x]

[Out]

-((Sqrt[a - b]*ArcTan[(Sqrt[b] + Sqrt[b]*Tan[e + f*x]^2 - Tan[e + f*x]*Sqrt[a + b*Tan[e + f*x]^2])/Sqrt[a - b]
] + Sqrt[b]*Log[-(Sqrt[b]*Tan[e + f*x]) + Sqrt[a + b*Tan[e + f*x]^2]])/f)

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(166\) vs. \(2(73)=146\).
time = 0.06, size = 167, normalized size = 1.96

method result size
derivativedivides \(\frac {b \left (\frac {\ln \left (\sqrt {b}\, \tan \left (f x +e \right )+\sqrt {a +b \left (\tan ^{2}\left (f x +e \right )\right )}\right )}{\sqrt {b}}-\frac {\sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \tan \left (f x +e \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\tan ^{2}\left (f x +e \right )\right )}}\right )}{b^{2} \left (a -b \right )}\right )+\frac {a \sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \tan \left (f x +e \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\tan ^{2}\left (f x +e \right )\right )}}\right )}{b^{2} \left (a -b \right )}}{f}\) \(167\)
default \(\frac {b \left (\frac {\ln \left (\sqrt {b}\, \tan \left (f x +e \right )+\sqrt {a +b \left (\tan ^{2}\left (f x +e \right )\right )}\right )}{\sqrt {b}}-\frac {\sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \tan \left (f x +e \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\tan ^{2}\left (f x +e \right )\right )}}\right )}{b^{2} \left (a -b \right )}\right )+\frac {a \sqrt {b^{4} \left (a -b \right )}\, \arctan \left (\frac {b^{2} \left (a -b \right ) \tan \left (f x +e \right )}{\sqrt {b^{4} \left (a -b \right )}\, \sqrt {a +b \left (\tan ^{2}\left (f x +e \right )\right )}}\right )}{b^{2} \left (a -b \right )}}{f}\) \(167\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/f*(b*(ln(b^(1/2)*tan(f*x+e)+(a+b*tan(f*x+e)^2)^(1/2))/b^(1/2)-(b^4*(a-b))^(1/2)/b^2/(a-b)*arctan(b^2*(a-b)/(
b^4*(a-b))^(1/2)/(a+b*tan(f*x+e)^2)^(1/2)*tan(f*x+e)))+a*(b^4*(a-b))^(1/2)/b^2/(a-b)*arctan(b^2*(a-b)/(b^4*(a-
b))^(1/2)/(a+b*tan(f*x+e)^2)^(1/2)*tan(f*x+e)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e)^2)^(1/2),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(b-a>0)', see `assume?` for mor
e details)Is

________________________________________________________________________________________

Fricas [A]
time = 2.81, size = 432, normalized size = 5.08 \begin {gather*} \left [\frac {\sqrt {b} \log \left (2 \, b \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {b} \tan \left (f x + e\right ) + a\right ) + \sqrt {-a + b} \log \left (-\frac {{\left (a - 2 \, b\right )} \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-a + b} \tan \left (f x + e\right ) - a}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, f}, \frac {2 \, \sqrt {a - b} \arctan \left (-\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a}}{\sqrt {a - b} \tan \left (f x + e\right )}\right ) + \sqrt {b} \log \left (2 \, b \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {b} \tan \left (f x + e\right ) + a\right )}{2 \, f}, -\frac {2 \, \sqrt {-b} \arctan \left (\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-b}}{b \tan \left (f x + e\right )}\right ) - \sqrt {-a + b} \log \left (-\frac {{\left (a - 2 \, b\right )} \tan \left (f x + e\right )^{2} + 2 \, \sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-a + b} \tan \left (f x + e\right ) - a}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, f}, \frac {\sqrt {a - b} \arctan \left (-\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a}}{\sqrt {a - b} \tan \left (f x + e\right )}\right ) - \sqrt {-b} \arctan \left (\frac {\sqrt {b \tan \left (f x + e\right )^{2} + a} \sqrt {-b}}{b \tan \left (f x + e\right )}\right )}{f}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e)^2)^(1/2),x, algorithm="fricas")

[Out]

[1/2*(sqrt(b)*log(2*b*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(b)*tan(f*x + e) + a) + sqrt(-a + b)*l
og(-((a - 2*b)*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(-a + b)*tan(f*x + e) - a)/(tan(f*x + e)^2 +
1)))/f, 1/2*(2*sqrt(a - b)*arctan(-sqrt(b*tan(f*x + e)^2 + a)/(sqrt(a - b)*tan(f*x + e))) + sqrt(b)*log(2*b*ta
n(f*x + e)^2 + 2*sqrt(b*tan(f*x + e)^2 + a)*sqrt(b)*tan(f*x + e) + a))/f, -1/2*(2*sqrt(-b)*arctan(sqrt(b*tan(f
*x + e)^2 + a)*sqrt(-b)/(b*tan(f*x + e))) - sqrt(-a + b)*log(-((a - 2*b)*tan(f*x + e)^2 + 2*sqrt(b*tan(f*x + e
)^2 + a)*sqrt(-a + b)*tan(f*x + e) - a)/(tan(f*x + e)^2 + 1)))/f, (sqrt(a - b)*arctan(-sqrt(b*tan(f*x + e)^2 +
 a)/(sqrt(a - b)*tan(f*x + e))) - sqrt(-b)*arctan(sqrt(b*tan(f*x + e)^2 + a)*sqrt(-b)/(b*tan(f*x + e))))/f]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \sqrt {a + b \tan ^{2}{\left (e + f x \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e)**2)**(1/2),x)

[Out]

Integral(sqrt(a + b*tan(e + f*x)**2), x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e)^2)^(1/2),x, algorithm="giac")

[Out]

integrate(sqrt(b*tan(f*x + e)^2 + a), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \sqrt {b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tan(e + f*x)^2)^(1/2),x)

[Out]

int((a + b*tan(e + f*x)^2)^(1/2), x)

________________________________________________________________________________________